from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn

from media_platform.xhs.endpoints.routes import router as xhs_router
# from media_platform.weibo.api import router as weibo_router
# from media_platform.tieba.api import router as tieba_router
# from media_platform.bilibili.api import router as bilibili_router
# from media_platform.douyin.api import router as douyin_router
# from media_platform.kuaishou.api import router as kuaishou_router
# from media_platform.zhihu.api import router as zhihu_router

app = FastAPI(
    title="API",
    # description="支持小红书、微博、贴吧、B站、抖音、快手、知乎等平台的数据采集",
    version="1.0.0"
)

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# 注册各平台路由
app.include_router(xhs_router, prefix="/api/xhs", tags=["小红书"])
# app.include_router(weibo_router, prefix="/api/weibo", tags=["微博"])
# app.include_router(tieba_router, prefix="/api/tieba", tags=["贴吧"])
# app.include_router(bilibili_router, prefix="/api/bilibili", tags=["B站"])
# app.include_router(douyin_router, prefix="/api/douyin", tags=["抖音"])
# app.include_router(kuaishou_router, prefix="/api/kuaishou", tags=["快手"])
# app.include_router(zhihu_router, prefix="/api/zhihu", tags=["知乎"])

if __name__ == "__main__":
    uvicorn.run("app:app", host="0.0.0.0", port=43657, reload=True) 